import request from "@/utils/request";
import { SystemConfigQuery, SystemConfigPageResult, SystemConfigForm, SystemConfig } from "./model";

/**
 * 系统设置API
 */
class SystemConfigAPI {

  /**
   * 系统设置分页数据
   * @param queryParams 
   * @returns 
   */
  static getPage(queryParams?: SystemConfigQuery) {
    return request<any, SystemConfigPageResult>({
      url:
        "/systemConfig/getPage?currentPage=" +
        queryParams?.pageNum +
        "&size=" +
        queryParams?.pageSize,
      method: "post",
      data: queryParams,
    });
  }

  /**
   * 获取系统设置.列表
   * @param data 
   * @returns 
   */
  static getList(data: SystemConfigQuery) {
    return request<any, SystemConfig[]>({
      url: "/systemConfig/getList",
      method: "post",
      data: data,
    });
  }


  /**
   * 新增系统设置.
   * @param data 
   * @returns 
   */
  static add(data: SystemConfigForm) {
    return request({
      url: "/systemConfig/add",
      method: "post",
      data: data,
    });
  }
  /**
   * 修改系统设置.
   * @param data 
   * @returns 
   */
  static update(data: SystemConfigForm) {
    return request({
      url: "/systemConfig/edit",
      method: "post",
      data: data,
    });
  }

  /**
   * 删除系统设置.
   * @param data 
   * @returns 
   */
  static delete(data: SystemConfigForm) {
    return request({
      url: "/systemConfig/delete",
      method: "post",
      data: data,
    });
  }

  /**
   * 批量保存系统设置.
   * @param data
   * @returns
   */
  static saveBatchData(data: SystemConfig[]) {
    return request({
      url: "/systemConfig/saveList",
      method: "post",
      data: data,
    });
  }


}

export default SystemConfigAPI;
